home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / bitstrg.zip / LCLEARBI.C < prev    next >
C/C++ Source or Header  |  1989-06-01  |  602b  |  34 lines

  1. /*
  2.     librairie : bitstrg
  3.  
  4.     lclearbit --    mise a 0l d'un bit
  5.  
  6.                     Le parametre nombre de bits est de type unsigned long
  7.  
  8.     Attention : en Small Memory Model le champ Data est limite a 64Koctets
  9.  
  10. */
  11.  
  12. #include "bitstrg.h"
  13.  
  14. /*
  15.     Clear specified bit
  16.  
  17.     if bit > map size, 0 is returned, else 1 is returned
  18. */
  19.  
  20. unsigned lclearbit(ptr,bit)
  21.     struct LSPARRAY * ptr;        /* pointer on structure */
  22.     unsigned long    bit;        /* bit number */
  23. {
  24.  
  25.     if(ptr->numlbit < bit) {
  26.         return(0);
  27.     }
  28.  
  29.         /* AND original with 0 */
  30.  
  31.     (ptr->pntarray)[bit / SIZE] &= ~(1 << (bit & (SIZE - 1)));    
  32.     return(1);
  33. }
  34.